// import { bindPhone } from "../../api/common"
import Toast from '../../components/vant/toast/toast';
let app = getApp();
Page({
    data: {
        statusHeight: app.globalData.window.statusHeight || 1,
        navheight: app.globalData.window.navheight || 1,
        isCheck: false,
    },
    getPhoneNumber(e) {
        if(!this.data.isCheck) {
            Toast.fail('请阅读并勾选底部协议')
            return false;
        }
        wx.navigateTo({ url: `/pages/bindPhone/phone/index` })
        // const { unionid, openid, sessionKey, openId } = wx.getStorageSync('wxUserDetails')
        // bindPhone({ code: e.detail.code, openId: openid || openId, unionid, sessionKey }).then(res => {
        //     wx.setStorageSync('wxToken', res.data.result.token)
        //     wx.setStorageSync('wxUserDetails', res.data.result)
        //     if (!res.data.result.sponsorList || res.data.result.sponsorList.length === 0) {
        //         wx.navigateTo({ url: '/pages/myContent/myContent' })
        //         return false;
        //     }
        //     if (res.data.result.sponsorList.length == 1) {
        //         wx.reLaunch({ url: '/pages/index/index' })
        //         return false;
        //     }
        //     if (res.data.result.sponsorList.length > 1) {
        //         wx.navigateTo({ url: '/pages/login/switch/index' })
        //         return false;
        //     }
        // })
    },
    changeCheck() {
        this.setData({ isCheck: !this.data.isCheck })
    },
    openAgreementBox(e) {
        wx.navigateTo({ url: `/pages/agreementBox/index_${e.currentTarget.dataset.type}/index` })
    }
})
